﻿@{
	ViewBag.Title = "Index";
	Layout = "~/Views/Shared/_Index.cshtml";
}

<div class="layuimini-container">
	<div class="layuimini-main">
		@* 数据表格顶部按钮 *@
		<script type="text/html" id="toolbarDemo">
			<div class="layui-btn-container" id="toolbar">
				@* <button id="NF-add" name="NF-add" authorize class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon">&#xe654;</i>新增</button>
					<button id="NF-edit" name="NF-edit" authorize class="layui-btn layui-btn-sm layui-btn-warm layui-hide" lay-event="edit"><i class="layui-icon">&#xe642;</i>修改</button> *@
				<button id="NF-delete" name="NF-delete" authorize class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="delete"> <i class="layui-icon">&#xe640;</i>删除</button>
				<button id="NF-Select" name="NF-Select" authorize class="layui-btn layui-btn-sm layui-btn-blue layui-hide" lay-event="select"> <i class="layui-icon">&#xe64c;</i>查看</button>
			</div>
		</script>
		@* 行按钮 *@
		<script type="text/html" id="currentTableBar">
			<a id="NF-delete" authorize class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete">删除</a>
			<a id="NF-Select" authorize class="layui-btn layui-btn-xs layui-btn-blue" lay-event="select">查看</a>
		</script>
		@* 数据表格 *@
		<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
	</div>
</div>

<script>
	layui.use(['jquery', 'form', 'table', 'common', 'layer', 'optimizeSelectOption', 'commonTable','laydate'], function () {
			var $ = layui.jquery,
			laydate=layui.laydate,
			form = layui.form,
			table = layui.table,
			layer = layui.layer,
			commonTable = layui.commonTable,
			common = layui.common;
		//权限控制(js是值传递)
		currentTableBar.innerHTML = common.authorizeButtonNew(currentTableBar.innerHTML);
		toolbarDemo.innerHTML = common.authorizeButtonNew(toolbarDemo.innerHTML);
		//行点击事件监听，控制按钮显示
		var oneList = ["NF-delete","NF-edit"];//选择1条显示
		var morerList = ["NF-delete"];//选中1条以上显示
		//commonTable.tableRowClick("radio", "currentTableFilter", "currentTableId", oneList, morerList); //单选框
		commonTable.tableRowClick("checkbox", "currentTableFilter", "currentTableId", oneList, morerList); //多选框
		var Id = $.request("id"); //账号id
		var type = $.request("type"); //类别
		// 数据表格
		commonTable.rendertable({
			elem: '#currentTableId',
			id: 'currentTableId',
			url: '/STZBManage/Account/Get_Weapons_GridJson?id='+Id+'&type='+type,
			filter: {
				clearFilter: false
			},
			limit:50, //默认显示20条数据
			cols: [[
				{ type: "checkbox", width: 50, fixed: 'left'},
				{ field: 'Name', title: '武器名称', minWidth: 120, sort: true, filter: true },
				{ field: 'Level', title: '武器层级', width: 120,hide:true, sort: true, filter: true,
					templet: function (d) {
						//Open_State：字典分类的ID
						return top.clients.dataItems["Level"][d.Level] == undefined ? d.State : top.clients.dataItems["Level"][d.Level];
					}
				},
				{ field: 'Entry', title: '武器词条', minWidth: 160, sort: true , filter: true,templet:function(d){
						return d.Entry+' ('+d.Attribute+')';
					}
				},
				{ field: 'Attribute', title: '武器属性', minWidth: 160, sort: true ,hide:true, filter: true },
				{ field: 'Gear', title: '武器档位', minWidth: 160, sort: true ,hide:true, filter: true },
				{ field: 'CreateTime', title: '创建时间', width: 160, sort: true , filter: { type: 'date[yyyy/MM/dd HH:mm:ss]' }}
			]]
		});

		//加载数据
		wcLoading.close();
	});
</script>